{extend name="base" /}
{block name="body"}
<div class="layui-card">
    <div class="layui-card-header">新增客户</div>
    <div class="layui-card-body">
        <form action="{:request()->url()}" class="layui-form" method="post">
            <div class="layui-form-item">
                <label class="layui-form-label">客户名称</label>
                <div class="layui-input-inline">
                    <input type="text" name="cname" value="{$data.cname|default=''}" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">客户名称:公司/个人</div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">客户电话</label>
                <div class="layui-input-inline">
                    <input type="text" name="mobile" value="{$data.mobile|default=''}" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">客户电话，不可重复</div>
            </div>
            {foreach name="config" item="config"}
            <div class="layui-form-item">
                <label class="layui-form-label">{$config.title}</label>
                <div class="layui-input-inline">
                    {if $config.type eq 'input'}
                    <input type="text" name="{$config.name}" value="{$config.value|default=''}" placeholder="请输入{$config.title}" class="layui-input">
                    {/if}
                    {if $config.type eq 'textarea'}
                    <textarea name="{$config.name}" placeholder="请输入{$config.title}" class="layui-textarea">{$config.value|default=''}</textarea>
                    {/if}
                    {if $config.type eq 'select'}
                    <select name="{$config.name}">
                        {foreach name=":parse_attr($config.options)" key="i" item="j"}
                        <option value="{$i}" {if condition="$config.value eq $i"}selected="selected"{/if}>{$j}</option>
                        {/foreach}
                    </select>
                    {/if}
                    {if $config.type eq 'radio'}
                    {foreach name=":parse_attr($config.options)" key="i" item="j"}
                    <input type="radio" name="{$config.name}" value="{$i}" title="{$j}" {if condition="$config.value eq $i"}checked="checked"{/if}>
                    {/foreach}
                    {/if}
                    {if $config.type eq 'image'}
                    <input type="text" name="{$config.name}" value="{$config.value|default=''}" autocomplete="off" placeholder="请上传{$config.title}" class="layui-input">
                    <button type="button" class="layui-btn layui-btn-primary layui-btn-position ajax-images"><i class="fa fa-file-image-o"></i> 选择图片</button>
                    {/if}
                </div>
                {if $config.is_sys eq '1'}
                <div class="layui-form-mid layui-word-aux"><a class="layui-btn layui-btn-xs" href="{:url('user/config/index')}">设置参数值</a></div>
                {/if}
            </div>
            {/foreach}
            
            
            <div class="layui-form-item">
                <label class="layui-form-label">选择地区</label>
                <div class="layui-input-inline">
                        <select name="province" lay-filter="province">
                                <option></option>
                        </select>
                </div>
                <script type="text/javascript">
			pca.init('select[name=province]', 'select[name=city]', 'select[name=area]', '北京', '北京', '朝阳区');
		</script>
                <div class="layui-input-inline">
                        <select name="city" lay-filter="city">
                                <option></option>
                        </select>
                </div>
                <script type="text/javascript">
			pca.init('select[name=province]', 'select[name=city]', 'select[name=area]', '北京', '北京', '朝阳区');
		</script>
                <div class="layui-input-inline">
                        <select name="area" lay-filter="area">
                                <option></option>
                        </select>
                </div>
                
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">详细地址</label>
                <div class="layui-input-inline">
                    <input type="text" name="address" value="{$data.address|default=''}" autocomplete="off" class="layui-input" style="width:450px;">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">备注信息</label>
                <div class="layui-input-block">
                    <textarea name="remark" class="layui-textarea">{$data.remark|default=''}</textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-filter="*" lay-submit="">保存</button>
                    <button class="layui-btn layui-btn-primary" type="reset">重置</button>
                </div>
            </div>
        </form>
    </div>
</div>


{/block}
{block name="js"}
<script src="/static/city-picker/layui-v1.0.4/layui/lay/dest/layui.all.js" type="text/javascript" charset="utf-8"></script>
<script src="/static/city-picker/js/citys.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
        pca.init('select[name=province]', 'select[name=city]', 'select[name=area]', '{$data.province}', '{$data.city}', '{$data.area}');
</script>
{/block}
